<%@include file="startUpIncludes.jsp" %>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <title>
            Import Leads
        </title>
    <script type="text/javascript" src="../js/modalwin.js">
    </script>
    <script type="text/javascript" >
 

        function disable(){  
        	//alert("inside disable");
        	if($("#ch").attr("checked")){
        		

        		$('.excelTB').each(function() {       	
            		$(this).attr("disabled", "disabled");
            	});
        		return;
    		}
        	$('.excelTB').each(function() {

            		$(this).removeAttr("disabled"); 
            	});
        		return;
    		
        	 	 
    }
    </script>
    <script type="text/javascript">
function doKeyUpValidation(text) {
    var validationRegex = RegExp(/[1-9]+/, "g");  // The regex was wrong
    if( !validationRegex.match(text.value) )
    {
        alert('Please enter only numbers.');
    }
} // this was missing before
</script>
<script type="text/javascript">
$(document).ready(function(){
    $('[id^=start]').keypress(validateNumber);
});
function validateNumber(event) {
    var key = window.event ? event.keyCode : event.which;

    if (event.keyCode == 8 || event.keyCode == 46
     || event.keyCode == 37 || event.keyCode == 39) {
        return true;
    }
    else if ( key < 48 || key > 57 ) {
        return false;
    }
    else return true;
};
        </script>
    </head>
    <body>
    <jsp:include page="header.jsp" >
		<jsp:param value="true" name="loggedIn"/>
	</jsp:include>
    <div class="wrap">
	<div class="fitBG">
        <div class="main">
		<%@include file="basicLeftMenu.jsp" %>
            <div class="content">
				<jsp:include page="tabs.jsp" >
					<jsp:param value="leads" name="currentPage"/>
				</jsp:include>
                <div class="tab-content">
                <h3>Leads</h3>
				<div class="lead-view">
				<%-- <form name="leadView" action="/sales/s/view">
				<span>View lead using: </span>
				<select class="TB" name="viewId">
                <c:forEach items="${ leadViews }" var="leadView">
					<option value="${ leadView.id }">${ leadView.name }</option>
				</c:forEach>
				</select>
				<input type="hidden" value="1" name="leadTypeId"/>
				<input type="submit" value="GO" class="inf"/>
				</form> --%>
				<a href="#">Edit Selected View</a>
				<a href="#">Create New View</a>
				</div>
                <div class="content-block">
                    <h4>Import Leads</h4>
                    <div class="action-btns">
                        <a href="newLead" class="form-btn">New Lead</a>
                        <a href="leads" class="form-btn">Cancel</a>
                  		<%--<a class="form-btn">Change Status</a>
                        <a class="form-btn">Change Owner</a>--%>
                    </div>
                    <div class="importInfo" >
                    
                    <span class="info">Make sure your Excel sheet have the same fields as displayed...</span>
              <form class="import-lead-form" action="/sales/s/importLeads" method="post" enctype="multipart/form-data"> 
                   <form:form ccsClass="import-lead-form" commandName="columnsForm" action="/sales/s/importLeads" method="post" enctype="multipart/form-data" >
                   <form:errors path="*" cssClass="error-block-" element="div"/>
                    <table class="recent-leads">
                        <thead>
                            <tr>
                            	<th class="xxl">Same Order</th>
                                <th class="xxl">Lead Owner</th>
                                <th class="xxl">First Name</th>
                                <th class="xxl">Last Name</th>
                                <th class="xxl">Company Name</th>
                                <th class="xxl">Title</th>
                                <th class="xxl">Phone</th>
                                <th class="xxl">Lead Status</th>
                                <th class="xxl">Email</th>
                                <th class="xxl">Rating</th>
                                <th class="xxl">Web Site</th>
                                <th class="xxl">Number Of Employees</th>
                                <th class="xxl">Annual Revenue</th>
                                <th class="xxl">Description</th>
                                <th class="xxl">Lead Source</th>
                                <th class="xxl">Industry</th>
                                <th class="xxl">Address</th>
                                <th class="xxl">Postal Code</th>
                                <th class="xxl">Area</th>
                                <th class="xxl">Country</th>
                                <th class="xxl">City</th>
                                <th class="xxl">Creation Date</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr class="even">
                           		<td class="xxl"><input type="checkbox" name="flag" value="1" onclick="" onchange="disable();" id="ch"/></td>
                                <td class="xxl"><form:input path="leadOwner" cssClass="excelTB" maxlength="2" size="2" /></td>
                                <td class="xxl"><form:input path="firstName" cssClass="excelTB" maxlength="2" size="2" /></td>
                                <td class="xxl"><form:input path="lastName" cssClass="excelTB" maxlength="2" size="2" /></td>
                                <td class="xxl"><form:input path="companyName" cssClass="excelTB" maxlength="2" size="2" /></td>
                                <td class="xxl"><form:input path="title" cssClass="excelTB" maxlength="2" size="2" /></td>
                                <td class="xxl"><form:input path="phone" cssClass="excelTB" maxlength="2" size="2" /></td>
                                <td class="xxl"><form:input path="leadStatus" cssClass="excelTB" maxlength="2" size="2" /></td>
                                <td class="xxl"><form:input path="email" cssClass="excelTB" maxlength="2" size="2" /></td>
                                <td class="xxl"><form:input path="rating" cssClass="excelTB" maxlength="2" size="2" /></td>
								<td class="xxl"><form:input path="webSite" cssClass="excelTB" maxlength="2" size="2" />      </td>                          
                                <td class="xxl"><form:input path="numOfEmp" cssClass="excelTB" maxlength="2" size="2" /></td>
                                <td class="xxl"><form:input path="annualRevenue" cssClass="excelTB" maxlength="2" size="2" /></td>
                                <td class="xxl"><form:input path="description" cssClass="excelTB" maxlength="2" size="2" /></td>
                                <td class="xxl"><form:input path="leadSource" cssClass="excelTB" maxlength="2" size="2" /></td>
                                <td class="xxl"><form:input path="industry" cssClass="excelTB" maxlength="2" size="2" /></td>
                                <td class="xxl"><form:input path="address" cssClass="excelTB" maxlength="2" size="2" /></td>
                                <td class="xxl"><form:input path="postalCode" cssClass="excelTB" maxlength="2" size="2" /></td>
                                <td class="xxl"><form:input path="area" cssClass="excelTB" maxlength="2" size="2" /></td>
                                <td class="xxl"><form:input path="country" cssClass="excelTB" maxlength="2" size="2" /></td>
                                <td class="xxl"><form:input path="city" cssClass="excelTB" maxlength="2" size="2" /></td>
                                <td class="xxl"><form:input path="creationDate" cssClass="excelTB" maxlength="2" size="2" /></td>
                            </tr>
                        </tbody>
                    </table>
                   	  <div class="importFormFields">
                   		<label>Enter Start Raw:</label>
                   		<form:input path="start" name="start" class="TB"/><form:errors cssClass="error-block" path="start" ></form:errors>
	                    <br/>
	                    <label>Choose leads file to upload:</label> 
	                    <form:input type="file" class="TB file-input" path="fileInput" name="fileInput" id="fileInput"/>
	                    <input type="submit" value="Upload" class="form-btn" />
	                  </div>
                    </form:form>
                    </div>
                </div>
                </div>
            </div>
        </div>
        
    <%@include file="footer.jspf" %>
    </div>
    </div>

    </body>
</html>